﻿<%@ Page Language="C#" MasterPageFile="~/master.Master" ValidateRequest="false" AutoEventWireup="true" CodeBehind="RelatedInfoDetail.aspx.cs"
    Inherits="CaseStudy.AdminPortal.RelatedInfoDetail" %>

<%@ Register Src="~/UserControl/LoginInfo.ascx" TagName="LoginInfo" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <uc1:LoginInfo ID="loginInfo" runat="server" />
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <div class="SiteMap">
        <div class="MapItem"><a href="Default.aspx" target="_self">首页</a></div>
        <div class="MapItem">/</div>
        <div class="MapItem"><a href="RelatedInfoManager.aspx" target="_self">相关信息管理</a></div>
        <div class="MapItem">/</div>
        <div class="CurrentMapItem" id="currentMapItem" runat="server"></div>
    </div>
    <div class="RelatedInfoDetailContent">
        <div class="RelatedInfoTitle">相关信息：</div>
        <div id="divReminding" class="Reminding" runat="server" visible="false"></div>
        <div class="RelatedInfoBody">
            <div class="InfoItem">
                <div class="ItemText">标题：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtTitle" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">地址：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtUrl" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">显示在性能区域：</div>
                <div class="ItemInput">
                    <div class="ControlDiv">
                        <asp:CheckBox ID="chkCapabilities" runat="server" />
                    </div>
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">显示在行业集中区域：</div>
                <div class="ItemInput">
                    <div class="ControlDiv">
                        <asp:CheckBox ID="chkIndustryFocus" runat="server" />
                    </div>
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">设置全局：</div>
                <div class="ItemInput">
                    <div class="ControlDiv">
                        <asp:CheckBox ID="chkGlobal" runat="server" Checked="true" />
                    </div>
                </div>
                <input id="inputIsGlobal" type="hidden" value="<%= ViewState["IsGlobal"] %>" />
            </div>
            <div class="InfoItem" id="divCategory">
                <div class="ItemText">类型：</div>
                <div class="ItemInput">
                    <div class="ControlDiv">
                        <div class="CheckItem">
                            <asp:CheckBox ID="chkIndustry" runat="server" Text="行业分类" />
                        </div>
                        <div class="CheckItem">
                            <asp:CheckBox ID="chkClient" runat="server" Text="客户分类" />
                        </div>
                        <div class="CheckItem">
                            <asp:CheckBox ID="chkService" runat="server" Text="服务分类" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="InfoItem" id="divCaseStudy">
                <div class="ItemText">成功案例：</div>
                <div class="ItemInput">
                    <div class="ControlDiv">
                        <a href="#" id="btnCaseStudy" class="ChooseCaseStudy" rel="#promptCaseStudy" onclick="CallPop('<%= hiddenCSChosen.ClientID %>', 'CSCss')">选择成功案例</a>
                    </div>
                    <div id="caseStudyChosen" class="technologyChosen"></div>
                    <asp:HiddenField ID="defaultCaseStudies" runat="server" Value='' />
                    <asp:HiddenField ID="hiddenCSChosen" runat="server" Value='' />
                </div>
            </div>

            <div class="ItemButtons">
                <div class="ItemButton">
                    <asp:ImageButton ID="imgBtnConfirm" runat="server" ImageUrl="images/Button_Confirm.png"
                        OnClick="imgBtnConfirm_Click" />
                </div>
                <div class="ItemButton">
                    <asp:ImageButton ID="imgBtnReset" runat="server" CausesValidation="false" ImageUrl="images/Button_Reset.png"
                        OnClick="imgBtnReset_Click" />
                </div>
                <div class="ItemButton">
                    <asp:ImageButton ID="imgBtnReturn" runat="server" CausesValidation="false" ImageUrl="images/Button_Return.png"
                        OnClick="imgBtnReturn_Click" />
                </div>
            </div>
        </div>

        <div class="ChooseContent" id="promptCaseStudy">
            <div class="ChooseCaseStudyTitle">成功案例信息：</div>
            <div class="ChooseCaseStudyBody">
                <asp:Table ID="tblCaseStudy" runat="server">
                </asp:Table>
                <div class="ItemButtons">
                    <div class="ItemButton">
                        <input id="caseStudyConfirm" class="btnConfirm" type="button" />
                    </div>
                    <div class="ItemButton">
                        <input id="caseStudyCancel" class="btnCancel close" type="button" />
                    </div>
                </div>
            </div>
        </div>
    </div>


    <script type="text/javascript">
        $(document).ready(function () {

            var Requset = new Object();
            Requset = GetRequest();
            var mode = Requset['mode'];
            if (mode == "view") {
                document.getElementById('caseStudyConfirm').style.display = "none";
            }

            if ($("#inputIsGlobal").val() == "true") {
                document.getElementById("divCategory").style.display = "none";
                document.getElementById("divCaseStudy").style.display = "none";
            }
            else {
                document.getElementById("divCategory").style.display = "block";
                document.getElementById("divCaseStudy").style.display = "block";
            }

            var divCSChosen = document.getElementById("caseStudyChosen");

            var caseStudiesDefault = document.getElementById("<%= defaultCaseStudies.ClientID %>").value;
            var caseStudies = caseStudiesDefault.split(",");

            for (var i = 0; i < caseStudies.length; i++) {
                var caseStudy = document.createElement('div');
                caseStudy.innerHTML = caseStudies[i];
                caseStudy.className = "ChosenItemText";

                divCSChosen.appendChild(caseStudy);
            }

            var triggersCaseStudy = $("#btnCaseStudy").overlay({

                // some mask tweaks suitable for modal dialogs
                mask: {
                    color: '#ebecff',
                    loadSpeed: 200,
                    opacity: 0.9
                },

                closeOnClick: false
            });

            $("#caseStudyConfirm").bind("click", function (e) {
                // close the overlay
                triggersCaseStudy.eq(0).overlay().close();

                var divTechChosen = document.getElementById("caseStudyChosen");
                var divs = divTechChosen.getElementsByTagName("div");
                for (var i = divs.length; i > 0; i--) {
                    var v = divs[i - 1];
                    divTechChosen.removeChild(v);
                }

                var lblCaseStudy = document.getElementById('<%= hiddenCSChosen.ClientID %>');
                lblCaseStudy.value = "";
                $("input:checked").each(function (index, domEle) {
                    if (domEle.parentElement.className == "CSCss") {

                        var caseStudy = document.createElement('div');
                        caseStudy.innerHTML = domEle.parentElement.title;
                        caseStudy.className = "ChosenItemText";

                        divTechChosen.appendChild(caseStudy);

                        var clientId = domEle.id;
                        var index = clientId.lastIndexOf('_') + 1;
                        var id = clientId.substring(index);
                        lblCaseStudy.value += id + ";"
                    }
                });

                // do not submit the form
                return e.preventDefault();
            });
        });
    </script> 
</asp:Content>

